name: CI

on:
  pull_request:
    paths-ignore:
    - '**.md'
  push:
    paths-ignore:
    - '**.md'

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]
        emacs_version: [27.2, 28.2, 29.3, snapshot]
        python_version: [3.10.13, 3.11.2, 3.12.4, 3.x]
        # include: clang on mac dont support c11 threads https://forums.developer.apple.com/forums/thread/15070
        #   - os: macos-latest
        #     emacs_version: snapshot
        #     python_version: 3.x
    steps:
    - uses: actions/checkout@v4
    - uses: purcell/setup-emacs@master
      with:
        version: ${{ matrix.emacs_version }}
    - uses: actions/cache@v4
      id: cache-cask-packages
      with:
        path: .cask
        key: cache-cask-packages-000
    - uses: actions/cache@v4
      id: cache-cask-executable
      with:
        path: ~/.cask
        key: cache-cask-executable-000
    - uses: cask/setup-cask@master
      if: steps.cache-cask-executable.outputs.cache-hit != 'true'
      with:
        version: snapshot
    - run: echo "$HOME/.cask/bin" >> $GITHUB_PATH
    - uses: actions/setup-python@v5
      with:
        python-version: ${{ matrix.python_version }}
        cache: 'pip'
    - run: 'pip install -r requirements.txt'
    - run: 'make test'
